﻿@if (Request.Browser.IsMobileDevice && Request.HttpMethod == "GET")
{
    <div class="view-switcher ui-bar-a">
        @if (Request.Url != null)
        {
            if (ViewContext.HttpContext.GetOverriddenBrowser().IsMobileDevice)
             {
                 @: Displaying mobile view
                 @Html.ActionLink("Desktop view", "SwitchView", "ViewSwitcher", new {mobile = false, returnUrl = Request.Url.PathAndQuery}, new {rel = "external"})
             }
             else
             {
                 @: Displaying desktop view
                 @Html.ActionLink("Mobile view", "SwitchView", "ViewSwitcher", new {mobile = true, returnUrl = Request.Url.PathAndQuery}, new {rel = "external"})
             }
        }
    </div>
}